<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div class="box no-border container_0 clearfix">

	<div class="box no-border">
		<div class="header">
			<h2>${pageTitle}</h2>
		</div>
		<c:choose>
			<c:when test="${type eq '1' }">
				<isperp:grid url="customer/customer/listCustomer?type=${type }"
					gridId="customerGrid" altRows="true"
					cusEditUrl="customer/customer/edit?type=${type }"
					cusFormatterActions="true" gridTitle="${pageTitle}"
					multiselect="false" cusDeleteUrl="customer/customer/delete"
					ondbClickRowEvent="customerGrid.edit(rowid);">

					<jsp:attribute name="toolbar">
			 		<isperp:toolbar id="userToolbar">
			 		    
				 		<isperp:button id="userCreate" icon="icon-plus" text="新增"
								cssClass="nui-mainbtn" onclick="customerGrid.create();"></isperp:button> 
			 			
			 			</isperp:toolbar>
			 		
			</jsp:attribute>

					<jsp:attribute name="searchbar">
			
			<table class="search-table">
				<tbody>
					<tr>
						<td class='td1'>名称：</td>
						<td class='td2' colspan="3"><input type="text" field="name"
										op="cn">
							</td>
						
						</tr>
						<tr>
						<td class='td1'>类型：</td>
						<td class='td2'><input type="text" field="type" op="cn">
							</td>
						<td class='td1'>区域：</td>
						<td class='td2'><input type="text" field="area" op="cn">
							</td>
					</tr>
				</tbody>
			</table>
			
	</jsp:attribute>
					<jsp:body>
			<isperp:column name="id" title="id" hidden="true"></isperp:column>
			<isperp:column name="code" title="编号" width="90">
			</isperp:column>
			<isperp:column name="name" title="名称" width="150">
			</isperp:column>
			<isperp:column name="linkman" title="联系人" width="80">
			</isperp:column>
			<isperp:column name="linktel" title="联系电话" width="80">
			</isperp:column>
			<isperp:column name="address" title="联系地址" width="200">
			</isperp:column>
		</jsp:body>


				</isperp:grid>
			</c:when>
			<c:otherwise>
				<isperp:grid url="customer/customer/listCustomer?type=${type }"
					gridId="customerGrid" altRows="true"
					cusEditUrl="customer/customer/edit" cusFormatterActions="true"
					gridTitle="${pageTitle}" multiselect="false" showSearchbar="false"
					ondbClickRowEvent="customerGrid.edit(rowid);">

					<jsp:attribute name="toolbar">
			 		<isperp:toolbar id="userToolbar">
			 			</isperp:toolbar>
			 		
			</jsp:attribute>

					<jsp:attribute name="searchbar">
			
			<table class="search-table">
				
			</table>
			
	</jsp:attribute>
					<jsp:body>
			<isperp:column name="id" title="id" hidden="true"></isperp:column>
			<isperp:column name="code" title="编号" width="90">
			</isperp:column>
			<isperp:column name="name" title="名称" width="150">
			</isperp:column>
			
			<isperp:column name="linkman" title="联系人" width="80">
			</isperp:column>
			<isperp:column name="linktel" title="联系电话" width="80">
			</isperp:column>
			<isperp:column name="address" title="联系地址" width="200">
			</isperp:column>
		</jsp:body>


				</isperp:grid>
			</c:otherwise>
		</c:choose>


	</div>
	<isperp:operate code="CUS_CUSTOMER"></isperp:operate>
</div>
<script type="text/javascript">
	function nameFormatter(cellvalue) {
		return "<a target='blank' href='"+ cellvalue +"'>" + cellvalue + "</a>";
	}
	function fmt(cellvalue) {
		if (cellvalue == 'company') {
			return '本公司';
		} else {
			return '客户'
		}
	}
</script>